/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: workerdescriptor_manager_proxy.hpp
 */

#ifndef _WORKERDESCRIPTOR_MANAGER_PROXY_HPP_
#define _WORKERDESCRIPTOR_MANAGER_PROXY_HPP_

#include <iostream>
#include <string>

#include "worker_descriptor.hpp"
#include "proxy_exception.hpp"
#include "workerdescriptor_manager.hpp"

//-----------------------------------------------------------------------------
// Enum, struct, aliases
namespace middleware {
typedef struct {
	std::string ip_bind_disc; /* IP to bind to in order to listen for wds */
	std::string port_bind_disc; /* PORT to bind to in order to listen for wds */
} WDProxyConfig;
}
//-----------------------------------------------------------------------------
// Class definitions
namespace middleware {
/*!
 * This class provides network interface to send and receive tasks. It is
 * important to notice that constructor is private in order to let a factory
 * perform such a work.
 */
class WorkerDescriptorManagerProxy : public WorkerDescriptorManager {
	/*!
	 * To let factory build properly this object, we provide access to every
	 * part of it.
	 */
	friend class WorkerDescriptorProxyFactory;
public:
	/*!
	 * Destructor
	 */
	~WorkerDescriptorManagerProxy();
	/*!
	 * Receives a worker descriptor.
	 */
	WorkerDescriptor recv_workerdescriptor() throw(ProxyException);
private:
	/*!
	 * Privately constructs the object. Default configuration with local
	 * loopback address and invalid port.
	 */
	WorkerDescriptorManagerProxy();
	/*!
	 * Privately constructs the object. Assigning configuration.
	 */
	explicit WorkerDescriptorManagerProxy(WDProxyConfig conf);
	/*!
	 * Parameters for proxy.
	 */
	WDProxyConfig _config;
}; /* TaskManagerProxy */
} /* middleware */

#endif
